<!DOCTYPE html>
<html>
<head>
<title>::: 골프인 :::</title>
<meta charset="utf-8" />
<meta name="Keywords" content="" />
<meta name="Description" content="" />
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

<!--[if IE 6]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<script type="text/javascript" src="../js/DD_belatedPNG_0.0.8a-min.js"></script>
<script type="text/javascript">DD_belatedPNG.fix('.png_bg, .footer, footer, img');</script>
<![endif]-->
<!-- 여기 위치에 두 스크립트 추가 부탁드립니다. -->
<script>
	if(document.domain == "www.golfinsns.com") document.location.href = "/temp.html";
	if(document.domain == "asp.golfinsns.com") document.location.href = "/asp/login.do";
	if(document.domain == "super.golfinsns.com") document.location.href = "/admin/loginForm.do";
</script>
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.18.custom.min.js"></script>
<script type="text/javascript" src="js/json2.js"></script>
<script>
jQuery(function($){
	function getRequestString(objPub, objParameter){
		var szPub = "";
		var szParameter = "";
		var szRet = '{"msp":{"header":{"client":"","device":{"model":"UNIT-1","firmware":"ios292sd","ip":"192.168.0.1"}},';
		
		szRet += '"params":{"pub":{';
		
		if(typeof objPub == "string"){
			szPub = objPub;
		}else{
			for(var key in objPub){
				if(szPub) szPub += ",";
				szPub += '"' + key + '":"' + objPub[key] + '"';
			}
		}
		
		szRet += szPub + "},";
		szRet += '"parameter":[';
		
		if(typeof objParameter == "string"){
			szParameter += objParameter;
		}else{
			for(var key in objParameter){
				if(szParameter) szParameter += ",";
				szParameter += '{"@name":"' + key + '","$":"' + objParameter[key] + '"}';
			}
		}
		
		szRet += szParameter + "]}}}";
		
		return szRet;
	}
	
	$("input:button").click(function(){
		$("textarea:eq(4)").val("");
		
		// ajax
		var ret = "";
		
		if($("textarea:eq(0)").val()) req = $("textarea:eq(0)").val();
		else req = getRequestString($("textarea:eq(1)").val(), $("textarea:eq(2)").val());
		
		$("textarea:eq(3)").val(req);
		
		//var req = '{"msp":{"header":{"client":"","device":{"model":"UNIT-1"}},"params":{"pub":{"sid":"US001","servicename":"login","listcount":10,"currpageno":1},"parameter":[{"@name":"userId","$":"' + this.loginRequest["아이디"] + '"},{"@name":"pw","$":"' + this.loginRequest["비밀번호"] + '"}]}}}';
		$.ajax({
			//url: "http://darkflash.woobi.co.kr/ajax_proc.php"
			url: "http://" + $("input:text:eq(0)").val() + ":8080/dcd/request.do"
			//url: "/request.do"
			, type: "GET"
			, data: {
				"userid": $("input:text:eq(1)").val()
				, "method": "json"
				, "req": req
			}
			, dataType: "jsonp"
			, jsonp: "msp300"
			, timeout: 10000
			, success: function(ret, sta){
				var st = JSON.stringify(ret);
				
				$("textarea:eq(4)").val(st);
			}
			, error: function(xhr, sta, err){
				alert(sta);
			}
			, complete: function(xhr, sta){
				
			}
		});
	});
});
</script>
</head>

<body>
server ip: <input type="text" value="192.168.0.81">
userid: <input type="text"><br>
req: <textarea style="width:400px; height:300px;"></textarea>
pub: <textarea style="width:400px; height:300px;"></textarea>
parameter: <textarea style="width:400px; height:300px;"></textarea>
<input type="button" value="submit"><br>
req: <textarea style="width:400px; height:300px;"></textarea>
msg: <textarea style="width:400px; height:300px;"></textarea>
</body>
</html>